<link rel="stylesheet" href="/ceca_two/css/offerDetails.css" />
<link rel="stylesheet" href="/ceca_two/css/supplierInfomation.css" />
<style>
	.materiaTextImg{
		width: 106px;
		height: 106px;
	}
	.tax_price{
		max-width: 80px;
		display: block;
	}
	.no_tax_price{
		max-width: 80px;
		display: none;
	}
	.price_box .tax_price{
		display: none;
	}
	.price_box .no_tax_price{
		display: block;
	}
	.price_btn,.info_btn{    
		display: inline-block;
    	height: 26px;
    	width: 50px;
    	vertical-align: middle;
		background: url(/ceca_two/img/icon_marketprice.png) no-repeat 0 5px;
		cursor: pointer;
	}
	.price_box .price_btn,.info_box .info_btn{
		background-position: 0 -24px;
	}
	
	.content .materialTable{
		position: relative;
		margin-top: 0;
	}
	.w160{
		min-width: 160px;
		position: absolute;
		top: 0;
		line-height: 1em;
	}
	.h80{
		height: 32px;
	}
	.info_name{
		display: none;
	}
	.no_info_name{
		display: block;
	}
	.info_box .info_name{
		display: block;
	}
	.info_box .no_info_name{
		display: none;
	}
	.leftDiv{
		float: left;
	}
	table tbody td{
		text-align: center;
		height: 50px;
		line-height: 50px;
		padding: 0;
		white-space: nowrap;
		overflow: hidden;
		
	}
	.w120{
		max-width: 166px;
	}
	/*table td:nth-child(1){
		width: 20%;
	}
	table td:nth-child(2),table tbody td:nth-child(3){
		width: 7%;
	}
	table td:nth-child(4),table  td:nth-child(6),table tbody td:nth-child(7),table tbody td:nth-child(8){
		width: 13%;
	}
	table td:nth-child(5){
		width: 14%;
	}*/
	table tbody{
		background: #FFFFFF;
	}
	.materialCName{
		height: 160px;
		white-space: initial;
	}
	.materialCName .leftDiv{
		padding: 20px;
		padding-bottom: 10px;
	}
	.materialCName .leftBot{
		margin-top: 10px;
		font-size: 12px;
		color: #999999;
		height: initial;
		line-height: initial;
	}
	.materialCName .rightDiv{
		height: initial;
		line-height: initial;
		font-size: 12px;
	}
	.materialCName .rightDiv .TextName{
		color: #0032d2;
		cursor: pointer;
	}
</style>
<!--header-->
<!--# include virtual="/ceca_two/common/html/header.html"-->
<div class="content">
<!--# include virtual="/ceca_two/modules/market/base/navClassify.html"-->
	<div class="allClassify"></div>
	<div class="technologyNav">
		<ul class="technologyNavUl">
			<li>全部分类</li>><li></li>><li></li>
			<!--<li><span>价格</span><span class="top"></span><span class="bottom"></span></li>
			<li><span>发布时间</span><span class="top"></span><span class="bottom"></li>
			<li><span>平台登记时间</span><span class="top"></span><span class="bottom"></li>-->
		</ul>
	</div>
	<table border="0" cellspacing="0" cellpadding="0" class="materialTable">
		<thead>
			<tr class="materialName">
				<td rowspan="2" width="28%">材料名称及规格</td>
				<td rowspan="2" width="8%">品牌</td>
				<td rowspan="2" width="14%">产品系列</td>
				<td rowspan="2" width="8%">单位</td>
				<td colspan="2" width="14%">
					<div class="h80">
						<p class="w160">除税价<em class="price_btn"></em>含税价</p>
					</div>
				</td>
				<td rowspan="2" width="14%" style="max-width: 166px;">
					<div class="h80" style="display: inline-block;width: 166px;">
						<p class="w160" style="top: 12px;min-width: 166px;">信息商<em class="info_btn"></em>材料商</p>
					</div>
				</td>
				<!--<td rowspan="2" width="12%">纳税性质</td>-->
				<td rowspan="2" width="14%">采集日期</td>
			</tr>
			<tr class="materialName Name">
				<td width="7%">最高</td>
				<td width="7%">最低</td>
			</tr>
		</thead>
		<tbody id="materialContent">
			
		</tbody>
	</table>
	<div id="laypage" style="margin-left: inheritem;text-align: center;" ></div>	
	<div class="contrast">
		<div class="contrastHead">
			<p class="message">[<span>0</span>/<span>4</span>]</p>
			<p class="messageText">材料对比</p>
			<p class="del">关闭</p>
		</div>
		<div class="contrastContent">
			<div class="contrastText">
				<input type="checkbox" name="" id="" value="" class="contrastTextChk"/>
				<img src="/ceca_two/img/prdt_spic.png" class="contrastTextImg"/>
				<h1 class="contrastTextName">三级抗震盘螺</h1>
				<ul class="contrastTextUl">
					<li>直径(mm)：<span>10</span></li>
					<li>牌号：<span>HRB400</span></li>
				</ul>
				<p class="contrastTextDel">×</p>
			</div>
		</div>
		<div class="contrastFooter">
			<div class="footerBtn">
				对比
			</div>
			<div class="delContrast">
				清空对比栏
			</div>
		</div>
	</div>
</div>
<script type="text/javascript" src="/ceca_two/js/materialPrice/offerDetails.js"></script>
<!--底部-->
<!--# include virtual="/ceca_two/common/html/footer.html"-->
</body>
<script id="allClassifyContent" type="text/html">
	<div class="allClassifyContent">
		<img style="max-width: 274px;max-height: 274px;" src="{{d.imgUrl ||  d.commomImgUrl || '/ceca_two/img/prdt_mpic_big.png' }}" class="allClassifyImg"/>
		<div class="allClassifyText">
			<h1 class="allClassifyName">{{ d.materialName}}</h1>
			<ul class="allClassifyUl">
				{{#  d.specificcations =jQuery.parseJSON(d.specificcations);}}
				{{# layui.each(d.specificcations, function(index, item){ }}
				    {{# layui.each(item, function(i, it){ }}
						{{#if(d.num>=0){d.num=d.num+1;}else{d.num=0}}}
							
							{{# if(i!="品种"){ }}
								<li>{{i}}<span>{{it}}</span></li>
							{{# } }}
						{{#if(d.num%2==1){}}<br>{{#}}}
					{{# }); }}
				{{# }); }}
			</ul>
		</div>
	</div>
</script>
<script id="material" type="text/html">
	{{# layui.each(d, function(index, item){ }}
		<tr style="border-top: 1px solid #CCCCCC;"  >
			<td>
				<div class="materialCName">
					<div class="leftDiv">
						<img src="{{item.materialPic ||item.imgUrl ||  item.commomImgUrl || '/ceca_two/img/prdt_mpic.png' }} " class="materiaTextImg"/>  
						<!--<div class="leftBot">
							<input type="checkbox" class="TextChk" id="TextChk1"/>
							<label for="TextChk1" class="TextLbl">加入对比</label>
						</div>-->
					</div><div class="rightDiv" style="width: 160px;height: 100%;display: table;vertical-align: middle;float: none;margin-top: 0px;">
						<div style="display: table-cell;vertical-align: middle;">
							<h1 onclick="window.open('/ceca_two/modules/market/offerDetailsInfomation.html?supplierId={{item.supplierId}}&offerId={{item.offerId}}')" class="TextName" style="font-size: 18px;font-family: '黑体';">{{ item.materialName}}</h1>
							<p class="TextStandard">
								{{# var specificcations =jQuery.parseJSON(item.specificcations); }}
								{{#  $.each(specificcations, function(k,spec){  }}
								    {{#  $.each(spec, function(k,v){  }}
								    	{{# if(k!="品种"){ }}
								   			 {{  k+":"+v }}
								   		{{# } }}
								    {{# }); }}
								{{# }); }}
							</p>
						</div>
					</div>
				</div>
			</td>
			<td>{{# if(item.brand){  }}{{item.brand}}{{# } }}</td>
			<td>{{# if(item.productLine){  }}{{item.productLine}}{{# } }}</td>
			<td>{{# if(item.units){  }}{{item.units}}{{# } }}</td>
			<td>
				<span class="tax_price">{{# if(item.maxTaxPrice){  }}{{item.maxTaxPrice}}{{# } }}</span>
				<span class="no_tax_price">{{# if(item.maxNoTaxPrice){  }}{{item.maxNoTaxPrice}}{{# } }}</span>
			</td>
			<td>
				<span class="tax_price">{{# if(item.maxTaxPrice){  }}{{item.maxTaxPrice}}{{# } }}</span>
				<span class="no_tax_price">{{# if(item.minNoTaxPrice){  }}{{item.minNoTaxPrice}}{{# } }}</span>
			</td>
			<td class="w120">
				<span class="no_info_name">{{# if(item.supplierName){  }}{{item.supplierName}}{{# } }}</span>
				<span class="info_name">{{# if(item.infoSupplierName){  }}{{item.infoSupplierName}}{{# } }}</span>
			</td>
			<!--<td>{{# if(item.supplierNature){  }}{{item.supplierNature}}{{# } }}</td>-->
			<td>{{# if(item.quotationDate){  }}{{item.quotationDate}}{{# } }}</td>
		</tr>
	{{# }); }}
</script>
<script>
layui.use(['Router','Zarea','Zutil','market','laytpl','laypage'], function() {
	var Router = layui.Router;
	var Zarea = layui.Zarea;
	var Zutil = layui.Zutil;
	var market= layui.market;
	var laytpl= layui.laytpl;
	var laypage= layui.laypage;
	
	var Url = Router.link.materialPrice.searchSolr;
//	var areaCodeStr=Zutil.getQueryString("categoryCode");
//	var search=Zutil.decodeURI(window.atob(Zutil.getQueryString("search")));
	
	function getCategory(categoryId){
		var navUrl = Router.link.materialPrice.getMarketCategory;
		$.post(navUrl,{},function(result){
			var categoryIdObj={};
			var data = result.data;
			var finalData=[];
			var datalength;
			var temp;
			for(var i=0;i<data.length;i++){
				categoryIdObj[data[i].categoryId]=data[i];
				if(data[i].categoryParentId=="1"){
					temp=data[i];
					temp["sonlassift"]=[];
					finalData.push(temp);
				}
			}
			for(var i=0;i<finalData.length;i++){
				for(var j=0;j<data.length;j++){
					if(data[j].categoryParentId==finalData[i].categoryId){
						finalData[i]["sonlassift"].push(data[j]);
					}
				}
			}
			categoryIdObj;
			var cate3=categoryIdObj[categoryId];
			var cate2=categoryIdObj[cate3.categoryParentId];
			var cate1=categoryIdObj[cate2.categoryParentId];
			$(".technologyNavUl li").eq(2).html("材料名称："+cate2.categoryName);
			$(".technologyNavUl li").eq(1).html("分类名称："+cate1.categoryName);
//			$(".technologyNavUl li").eq(0).html(cate1.categoryName);
			laytpl(classiftItem.innerHTML).render(finalData, function(html){
				classiftBox.innerHTML = html;
				$(".classiftListNext li").click(function(){
					var categoryName =window.btoa(Zutil.encodeURI($(this).attr("data-categoryName") || ""));
					window.location.href='/ceca_two/modules/market/screeningResults.html?areaCode='+Zutil.getQueryString("areaCode")+'&categoryName='+categoryName
				});
			});
		});
	}
	searchFunc();
	function getList(obj){
		$.post(Url,obj,function(result){
			var  data = result.data;
			laytpl(allClassifyContent.innerHTML).render(result.ext, function(html){
				$(".allClassify").html(html);
			});
			laytpl(material.innerHTML).render(data.list, function(html){
				$("#materialContent").html(html);
				laypage({
				    cont: 'laypage'
				    ,pages: data.totalPage
				    ,curr:data.pageNumber
				    ,groups:data.pageSize
				    ,skin: '#ff0000'
				    ,jump: function(opt, first){
					    var curr = opt.curr;   //得到了当前页，用于向服务端请求对应数据
					    obj.pageNumber = curr|| 1;
					    if(!first)getList(obj);
					  }
				});
			});
			getCategory(result.ext.categoryId);
		});
	}
	function marketFilter(obj){
		$.post(filterUrl,obj,function(result){
			var  data = result.data;
			laytpl(marketFilterTemplate.innerHTML).render(data, function(html){
				marketFilterHtml.innerHTML = html;
			});
		});
	}
	
	$(".ClassiftBtn").click(searchFunc);
	$("#ClassiftInput").keydown(function(event){
		var e = event || window.event || arguments.callee.caller.arguments[0];
		if(e && e.keyCode==13){ // enter 键
            searchFunc();
        }
	});
	
	function searchFunc(){
		var data ={
			 categoryId:Zutil.getQueryString("categoryId"),
			 search:Zutil.decodeURI(window.atob(Zutil.getQueryString("search") || ""))
		}
		getList(data);
//		marketFilter(data);
	}
	$(".price_btn").click(function(){
		if($(".content").hasClass("price_box")){
			$(".content").removeClass("price_box");
		}else{
			$(".content").addClass("price_box");
		}
	});
	$(".info_btn").click(function(){
		if($(".content").hasClass("info_box")){
			$(".content").removeClass("info_box");
		}else{
			$(".content").addClass("info_box");
		}
	});
});
</script>
</html>

